package com.example.design.factory.simplefactory;

/**
 * 简单工厂类
 */
public class AnimalFactory {
    public Animal createAnimal(String animalType) {
        if (animalType.equals("cat")) {
            return new Cat();
        } else if (animalType.equals("dog")) {
            return new Dog();
        }
        return null;
    }
}
